var bgDOM = null;
var yqlRequest = null;

function Refresh() {
	yqlRequest.parser.Print(document.getElementById('search_content'));
};

function Init() {
	// Get background page DOM
	bgDOM = chrome.extension.getBackgroundPage();
	yqlRequest = new bgDOM.YQLRequest(bgDOM.QUERY.SEARCH, new bgDOM.SearchParser());
	yqlRequest.onReady = Refresh;
	
	var parms = window.location.search.substring(1).split('&');
	for (var i=0; i < parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0, pos);
			var val = parms[i].substring(pos + 1);
			if (key == 'query') {
				yqlRequest.SetProperty('query', val);
				break;
			}
		}
	}
	
	bgDOM.yqlHandler.MakeRequest(yqlRequest);
};